hljs.configure({
    ignoreUnescapedHTML:true,
});
//hljs.initHighlightingOnLoad();
//hljs.initLineNumbersOnLoad();
$(function () {

    $('.w-e-text pre code').each(function(i, block) {
        hljs.highlightBlock(block);
    });

    $('.w-e-text pre code').each(function(i, block) {
        hljs.lineNumbersBlock(block);
    });

    $('.dlbtn').click(function () {
        var id = $(this).data('id');
        var idx = layer.msg('加载中', {
            icon: 16,
            shade: 0.5,
            content:'准备下载'
        });
        $.ajax({
            url:'/api/check/download/'+id,
            type:'POST',
            dataType:'json',
            success:function (str) {
                var res = JSON.parse(str);
                console.log(res)

                if (res.code == 0 || res.code == 6) {
                    var tmp = $('#tpl1').html().trim();
                    var txt = cctpl.render(tmp,{code:res.code,msg:res.msg})
                    layer.open({
                        type: 1,
                        //title:'资源信息',
                        //skin: 'layui-layer-rim', //加上边框
                        area: ['420px', '240px'], //宽高
                        content: txt
                    });
                }else{
                    layer.msg(res.msg, {icon: 5});
                }

            }
        });

    });

    //查看图片
    $('.wznr img').click(function () {
        
    });

});
